Practical Unit Testing with TestNG and Mockito by Tomek Kaczanowski

Practical Unit Testing with TestNG and Mockito by Tomek Kaczanowski

Author:Tomek Kaczanowski [Kaczanowski, Tomek]
Language: eng
Format: epub, mobi, pdf


The idea of independent tests has been around right from the start of unit testing, and not without good reason!

7.3. How Many Assertions per Test Method?

Chuck Norris can unit test an entire application with a single assert.

-- Wisdom of the Internet ;)

The idea of having only One Assertion Per Test Method (I will use the acronym OAPTM for this from here on) is quite popular among developers. Some of its popularity may be attributed to the misuse of multi-assertion test methods, which tend to grow into many lines of code (in the hands of inexperienced or incompetent developers). It has also been discussed on popular forums and promoted by a number of prominent TDD and testing proponents, including Dave Astel and Roy Osherove.

All of the code examples presented so far in this book make it quite obvious that I myself do not subscribe to this idea and do not follow it. And even though I understand and share some of the motivations behind it, I will try to persuade you not to subscribe to it either – at least, not in its dogmatic version.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.